package com.trendit.print.sdk;

import com.alibaba.fastjson.JSON;

/**
 * @author zhouhaojie
 */
public class ObjectJsonParser<T extends DaquResponse> implements DaquParser<T> {

    private Class<T> clazz;

    public ObjectJsonParser(Class<T> clazz) {
        this.clazz = clazz;
    }

    @Override
    public T parse(String rsp) throws DaquApiException {
        return JSON.parseObject(rsp, getResponseClass());
    }

    @Override
    public Class<T> getResponseClass() {
        return this.clazz;
    }


}
